//
//  HDCFFundDetailMiddleCell.m
//  HaoDeCaiFu
//
//  Created by 郑开宏 on 2017/11/1.
//  Copyright © 2017年 郑开宏. All rights reserved.
//

#import "HDCFFundDetailMiddleCell.h"

@interface HDCFFundDetailMiddleCell ()

@property (weak, nonatomic) IBOutlet UILabel *timeStage;
@property (weak, nonatomic) IBOutlet UILabel *selfEarn;
@property (weak, nonatomic) IBOutlet UILabel *sameKindEarn;
@property (weak, nonatomic) IBOutlet UILabel *hushen300;


@end

@implementation HDCFFundDetailMiddleCell

- (void)setIndex:(NSInteger)index{
    _index = index;
    if (index == 0) {
        _timeStage.text = @"近1个月";
        NSNumber *OneEarn = _dictOne[@"month1"];
        if ([_dictOne[@"month1"] isKindOfClass:[NSNull class]]) {
            _selfEarn.text = @"--";
        }else{
            _selfEarn.text = [NSString stringWithFormat:@"%.2f%%", OneEarn.doubleValue];
        }
        NSNumber *twoEarn = _dictTwo[@"month1"];
        if ([_dictTwo[@"month1"] isKindOfClass:[NSNull class]]) {
            _sameKindEarn.text = @"--";
        }else{
            _sameKindEarn.text = [NSString stringWithFormat:@"%.2f%%", twoEarn.doubleValue];
        }
        NSNumber *threeEarn = _dictThree[@"month1"];
        if ([_dictThree[@"month1"] isKindOfClass:[NSNull class]]) {
            _hushen300.text = @"--";
        }else{
            _hushen300.text = [NSString stringWithFormat:@"%.2f%%", threeEarn.doubleValue];
        }
    }else if (index == 1){
        _timeStage.text = @"近3个月";
        NSNumber *OneEarn = _dictOne[@"month3"];
        if ([_dictOne[@"month3"] isKindOfClass:[NSNull class]]) {
            _selfEarn.text = @"--";
        }else{
            _selfEarn.text = [NSString stringWithFormat:@"%.2f%%", OneEarn.doubleValue];
        }
        NSNumber *twoEarn = _dictTwo[@"month3"];
        if ([_dictTwo[@"month3"] isKindOfClass:[NSNull class]]) {
            _sameKindEarn.text = @"--";
        }else{
            _sameKindEarn.text = [NSString stringWithFormat:@"%.2f%%", twoEarn.doubleValue];
        }
        NSNumber *threeEarn = _dictThree[@"month3"];
        if ([_dictThree[@"month3"] isKindOfClass:[NSNull class]]) {
            _hushen300.text = @"--";
        }else{
            _hushen300.text = [NSString stringWithFormat:@"%.2f%%", threeEarn.doubleValue];
        }
    }else if (index == 2){
        _timeStage.text = @"近6个月";
        NSNumber *OneEarn = _dictOne[@"month6"];
        if ([_dictOne[@"month6"] isKindOfClass:[NSNull class]]) {
            _selfEarn.text = @"--";
        }else{
            _selfEarn.text = [NSString stringWithFormat:@"%.2f%%", OneEarn.doubleValue];
        }
        NSNumber *twoEarn = _dictTwo[@"month6"];
        if ([_dictTwo[@"month6"] isKindOfClass:[NSNull class]]) {
            _sameKindEarn.text = @"--";
        }else{
            _sameKindEarn.text = [NSString stringWithFormat:@"%.2f%%", twoEarn.doubleValue];
        }
        NSNumber *threeEarn = _dictThree[@"month6"];
        if ([_dictThree[@"month6"] isKindOfClass:[NSNull class]]) {
            _hushen300.text = @"--";
        }else{
            _hushen300.text = [NSString stringWithFormat:@"%.2f%%", threeEarn.doubleValue];
        }
    }else if (index == 3){
        _timeStage.text = @"今年以来";
        NSNumber *OneEarn = _dictOne[@"yearToDate"];
        if ([_dictOne[@"yearToDate"] isKindOfClass:[NSNull class]]) {
            _selfEarn.text = @"--";
        }else{
            _selfEarn.text = [NSString stringWithFormat:@"%.2f%%", OneEarn.doubleValue];
        }
        
        NSNumber *twoEarn = _dictTwo[@"yearToDate"];
        if ([_dictTwo[@"yearToDate"] isKindOfClass:[NSNull class]]) {
            _sameKindEarn.text = @"--";
        }else{
            _sameKindEarn.text = [NSString stringWithFormat:@"%.2f%%", twoEarn.doubleValue];
        }
        NSNumber *threeEarn = _dictThree[@"yearToDate"];
        if ([_dictThree[@"yearToDate"] isKindOfClass:[NSNull class]]) {
            _hushen300.text = @"--";
        }else{
            _hushen300.text = [NSString stringWithFormat:@"%.2f%%", threeEarn.doubleValue];
        }
    }else if (index == 4){
        _timeStage.text = @"近1年";
        NSNumber *OneEarn = _dictOne[@"year1"];
        if ([_dictOne[@"year1"] isKindOfClass:[NSNull class]]) {
            _selfEarn.text = @"--";
        }else{
            _selfEarn.text = [NSString stringWithFormat:@"%.2f%%", OneEarn.doubleValue];
        }
        NSNumber *twoEarn = _dictTwo[@"year1"];
        if ([_dictTwo[@"year1"] isKindOfClass:[NSNull class]]) {
            _sameKindEarn.text = @"--";
        }else{
            _sameKindEarn.text = [NSString stringWithFormat:@"%.2f%%", twoEarn.doubleValue];
        }
        NSNumber *threeEarn = _dictThree[@"year1"];
        if ([_dictThree[@"year1"] isKindOfClass:[NSNull class]]) {
            _hushen300.text = @"--";
        }else{
            _hushen300.text = [NSString stringWithFormat:@"%.2f%%", threeEarn.doubleValue];
        }
    }else if (index == 5){
        _timeStage.text = @"近2年";
        NSNumber *OneEarn = _dictOne[@"year2"];
        if ([_dictOne[@"year2"] isKindOfClass:[NSNull class]]) {
            _selfEarn.text = @"--";
        }else{
           _selfEarn.text = [NSString stringWithFormat:@"%.2f%%", OneEarn.doubleValue];
        }
        
        NSNumber *twoEarn = _dictTwo[@"year2"];
        if ([_dictTwo[@"year2"] isKindOfClass:[NSNull class]]) {
            _sameKindEarn.text = @"--";
        }else{
            _sameKindEarn.text = [NSString stringWithFormat:@"%.2f%%", twoEarn.doubleValue];
        }
        
        NSNumber *threeEarn = _dictThree[@"year2"];
        if ([_dictThree[@"year2"] isKindOfClass:[NSNull class]]) {
            _hushen300.text = @"--";
        }else{
            _hushen300.text = [NSString stringWithFormat:@"%.2f%%", threeEarn.doubleValue];
        }
        
    }else if (index == 6){
        _timeStage.text = @"近3年";
        NSNumber *OneEarn = _dictOne[@"year3"];
        if ([_dictOne[@"year3"] isKindOfClass:[NSNull class]]) {
            _selfEarn.text = @"--";
        }else{
            _selfEarn.text = [NSString stringWithFormat:@"%.2f%%", OneEarn.doubleValue];
        }
        
        NSNumber *twoEarn = _dictTwo[@"year3"];
        if ([_dictTwo[@"year3"] isKindOfClass:[NSNull class]]) {
            _sameKindEarn.text = @"--";
        }else{
            _sameKindEarn.text = [NSString stringWithFormat:@"%.2f%%", twoEarn.doubleValue];
        }
        
        NSNumber *threeEarn = _dictThree[@"year3"];
        if ([_dictThree[@"year3"] isKindOfClass:[NSNull class]]) {
             _hushen300.text = @"--";
        }else{
             _hushen300.text = [NSString stringWithFormat:@"%.2f%%", threeEarn.doubleValue];
        }
       
    }
}

- (void)setDictOne:(NSDictionary *)dictOne{
    _dictOne = dictOne;
}

- (void)setDictTwo:(NSDictionary *)dictTwo{
    _dictTwo = dictTwo;
}

- (void)setDictThree:(NSDictionary *)dictThree{
    _dictThree = dictThree;
}

+ (instancetype)HDCFFundDetailMiddleCell{
    return [[NSBundle mainBundle] loadNibNamed:@"HDCFFundDetailMiddleCell" owner:nil options:nil].firstObject;
}

- (void)awakeFromNib {
    [super awakeFromNib];
    // Initialization code
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}

@end
